#include"lottery_sys.h"
int checkwinner(int* chose_nums,int* win_nums)
{
	insort(chose_nums);
	insort(win_nums);
	int count = 0;
	int i = 0,j = 0;
	while(i < 5 && j < 5)
	{
		if(chose_nums[i] == win_nums[j])
		{
			//printf("两个数组中重复的数字其中一个是:%d\n",chose_nums[i]);
			count++;
			i++;
			j++;
		}
		else if(chose_nums[i] > win_nums[j])
		{
			j++;
		}
		else i++;
	}
	return count;

}
void insort(int *number)
{
	int i = 0, j = 0, tmp = 0;
	for (j = 1; j < 5; j++)
	{
		tmp = number[j];
		i = j - 1;
		while (tmp < number[i])
		{
			number[i + 1] = number[i];
			i--;
			if (i == -1)
				break;
		}
		number[i + 1] = tmp;
	}
}
